<?php
session_start();
?>
<?php
require "lib/db.php";
require "lib/category-function.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Add SubCategory</title>
<link rel="stylesheet" type="text/css" href="css/home.css">
<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>

<script>
	$(document).ready(function() {
			$("#subcategory").css({"background-color":"#FFF",	
	"color":"#000"});
    });
</script>

<style>
	#content{
		width:40%;
		margin:10px auto;
		opacity:0.8;
	}
	
	input, textarea, select{
		width:100%;
	}
	
	#tdrequire{
		text-align:right;	
	}

</style>

</head>

<body>

<!--menu-->
<?php
require "menu.php";
?>

<!--content-->
<div id="content">
<form action="subcategorycontroller.php" method="post">
<table width="100%" border="0" cellspacing="0">
   <tr>
 	<td></td>
    <td id="tdrequire"><span id="require">*</span>: required value</td>
  </tr>
  <tr>
    <td>SubCategory Name<span id="require">*</span></td>
    <td><input name="txtSubCategoryName" type="text"></td>
  </tr>
  <tr>
    <td>Category Name<span id="require">*</span></td>
    <td>
        <select name="cbCategoryName">
        	<?php
			$listCategory = getAllCategory();
			while($category = mysql_fetch_array($listCategory)){
			?>
        	<option value="<?php echo $category['CategoryID'] ?>"><?php echo $category['CategoryName'] ?></option>
            <?php
			}
			?>
        </select>
    </td>
  </tr>
  <tr>
    <td>Description</td>
    <td><textarea name="taDescription" cols="" rows="10"></textarea></td>
  </tr>
  <tr>
  	<td></td>
    <td><input name="btnAddSubCategory" type="submit" value="Add SubCategory"></td>
    </tr>
</table>

</form>

</div>

<!--footer-->
<?php
require "footer.php";
?>

</body>
</html>